import React, { Component } from 'react';
import { user_register } from './utils/api'

class Login extends Component {
    constructor(props) {
        super(props);
        this.state(
            user = { nmae: '', pwd: '' }
        )
    }

    login() {

    }

    onchangename(value) {
        this.setState(
            this.state.name = value
        )
        console.log(this.state.name);
    }

    onchangepwd(value) {
        this.setState(
            this.state.pwd = value
        )
        console.log(this.state.pwd);
    }

    render() {
        return (
            <div className='login'>
                <div className="title">登录页</div>
                <div className="block">
                    <input type="text" placeholder='请输入账号' value={this.state.name} onChange={() => {
                        onchangename()
                    }} />
                </div>
                <div className="block">
                    <input type="password" placeholder='请输入密码' value={this.state.pwd} onChange={() => {
                        onchangepwd()
                    }} />
                </div>
                <div className="block">
                    <button onClick={() => { this.login() }}>登录</button>
                    <button>注册</button>
                </div>
            </div>
        );
    }
}

export default Login;